package com.ivo.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.ivo.model.Model;
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true)
@Table (name = "PDM_D_MAST_ATTR_INS")
public class MasterAttributeInstance extends Model {

	private static final long serialVersionUID = 6239038321287924479L;
	
	private Long attributeInsanceId;
	private String value;
	
	private MasterInstance masterInstance;
	private TemplateAttribute templateAttribute;
		
	public MasterAttributeInstance() {}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "MAST_ATTR_INS_ID")
	public Long getAttributeInsanceId() {
		return attributeInsanceId;
	}

	public void setAttributeInsanceId(Long attributeInsanceId) {
		this.attributeInsanceId = attributeInsanceId;
	}
	
	@Column(name = "VALUE")
	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "MAST_INS_FK")
	public MasterInstance getMasterInstance() {
		return masterInstance;
	}

	public void setMasterInstance(MasterInstance masterInstance) {
		this.masterInstance = masterInstance;
	}
	
	@OneToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "TMPL_ATTR_FK")
	public TemplateAttribute getTemplateAttribute() {
		return templateAttribute;
	}

	public void setTemplateAttribute(TemplateAttribute templateAttribute) {
		this.templateAttribute = templateAttribute;
	}

}
